package com.example.cardmatchinggame;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Deck {
    private List<Card> cards;

    public Deck(int cardCount, int mode) {
        cards = new ArrayList<>();
        String[] symbols = {"♠", "♥", "♦", "♣", "★", "♪", "☀", "☁", "☂", "☃", "✈", "⚡"};
        
        int pairsNeeded = mode == 2 ? cardCount / 2 : cardCount / 3;
        
        for (int i = 0; i < pairsNeeded; i++) {
            String symbol = symbols[i % symbols.length];
            for (int j = 0; j < mode; j++) {
                cards.add(new Card(symbol));
            }
        }
        
        Collections.shuffle(cards);
    }

    public Card drawCard() {
        if (!cards.isEmpty()) {
            return cards.remove(0);
        }
        return null;
    }

    public List<Card> getCards() {
        return cards;
    }
}
